﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using KC.DTO.Core;
using ProtoBuf;

namespace KC.Service.DTO.WorkFlow
{
    [Serializable, DataContract(IsReference = true)]
    [ProtoContract(ImplicitFields = ImplicitFields.AllPublic)]
    public class FlowListsDto : TreeNodeDTO<FlowListsDto>
    {
        public FlowListsDto()
        {
            this.Roles = new List<FlowStepRolesDto>();
            this.Departs = new List<FlowStepDepartsDto>();
            this.Users = new List<FlowStepUsersDto>();

        }
        
        [DataMember]
        [Display(Name = "子流程ID")]
        public int? ChildFlowId { get; set; }
        [DataMember]
        [Display(Name = "子流程名称")]
        [MaxLength(128, ErrorMessage = "输入{0}超长，最大可输入字符长度{1}")]
        public string ChildFlowName { get; set; }
        //[DataMember]
        //public string ChildFlowCap { get; set; }
        [DataMember]
        [Display(Name = "流程类别ID")]
        public int? TypeId { get; set; }
        [DataMember]
        [MaxLength(128, ErrorMessage = "输入{0}超长，最大可输入字符长度{1}")]
        public string TypeName { get; set; }
        [DataMember]
        [Display(Name = "备注")]
        [MaxLength(255,ErrorMessage = "输入{0}超长，最大可输入字符长度255")]
        public string Mimo { get; set; }
        [DataMember]
        [Display(Name = "序号")]
        public int? Rank { get; set; }
        [DataMember]
        [Display(Name = "步骤")]
        public int? RankOrder { get; set; }
        [DataMember]
        [Display(Name = "流程规则ID")]
        public Guid? RuleId { get; set; }
        [DataMember]
        [Display(Name = "应用ID")]
        public Guid ApplicationId { get; set; }
        [DataMember]
        [Display(Name = "应用名称")]
        [MaxLength(128, ErrorMessage = "输入{0}超长，最大可输入字符长度{1}")]
        public string ApplicationName { get; set; }
        /// <summary>
        /// 页面展示使用
        /// </summary>
        [DataMember]
        public string ModifyTime
        {
            get
            {
                return ModifiedDate.AddHours(8).ToString("yyyy-MM-dd HH:mm:ss"); 
            }
        }
        [DataMember]
        public string RoleCaps { get; set; }
        [DataMember]
        public string DepartCaps { get; set; }
        [DataMember]
        public string UserCaps { get; set; }
        [DataMember]
        public string ExpUserCaps { get; set; }

        [DataMember]
        public string UserIds { get; set; }

        [DataMember]
        public string RoleIds { get; set; }

        [DataMember]
        public string DepartIds { get; set; }
        [DataMember]
        public string IsDefaults { get; set; }

        [DataMember]
        public List<FlowBusiDefaultDto> Defaults { get; set; }
        [DataMember]
        public List<FlowStepRolesDto> Roles { get; set; }
        [DataMember]
        public List<FlowStepDepartsDto> Departs { get; set; }
        [DataMember]
        public List<FlowStepUsersDto> Users { get; set; }
    }
}
